#include "Interval.h"

const CInterval CInterval::EMPTY = CInterval(+g_INFINITY, -g_INFINITY);
const CInterval CInterval::UNIVERSE = CInterval(-g_INFINITY, +g_INFINITY);

CInterval::CInterval(const CInterval& vIntervalA, const CInterval& vIntervalB)
{
	m_Min = vIntervalA.m_Min <= vIntervalB.m_Min ? vIntervalA.m_Min : vIntervalB.m_Min;
	m_Max = vIntervalA.m_Max >= vIntervalB.m_Max ? vIntervalA.m_Max : vIntervalB.m_Max;
}

CInterval operator+(const CInterval& ival, double displacement)
{
	return CInterval(ival.m_Min + displacement, ival.m_Max + displacement);
}

CInterval operator+(double displacement, const CInterval& ival)
{
	return ival + displacement;
}